
public class ServerQuery {

	public QueryType query_type;
	public String raw_query;
	public Direction direction;
	public int num_fields;
	public MessageEncoding message_encoding;
	public String[] all_fields;
	
	public ServerQuery()
	{
		query_type = QueryType.UNKNOWN;
		raw_query = "";
		direction = Direction.Client2URS;
		num_fields = 0;
		message_encoding = MessageEncoding.US_ASCII;
		all_fields = new String[0];
	}
	
	public ServerQuery(QueryType query_type, String raw_query, Direction direction,
						int num_fields, MessageEncoding message_encoding)
	{
		this.query_type = query_type;
		this.raw_query = raw_query;
		this.direction = direction;
		this.num_fields = num_fields;
		this.message_encoding = message_encoding;
		this.all_fields = new String[0];
	}
	
	public ServerQuery(QueryType query_type, String raw_query, Direction direction,
			int num_fields, MessageEncoding message_encoding, String[] all_fields)
	{
		//		this.query_type = query_type;
		//		this.raw_query = raw_query;
		//		this.direction = direction;
		//		this.num_fields = num_fields;
		//		this.message_encoding = message_encoding;
		this(query_type, raw_query, direction,
				 	num_fields, message_encoding);
		this.all_fields = all_fields;
	}
	
	public String getRecord()
	{
		int recordStartIndex = 4;
		String record = "";
		String delimiter = ",";
		for (int i=recordStartIndex; i < all_fields.length; i++)
		{
			record += all_fields[i];
			if(i < all_fields.length-1)
				record += delimiter;
		}

		return record;
	}
}
